home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Shareware Grab Bag
/
Shareware Grab Bag.iso
/
090
/
byt86aug.arc
/
MACAPP.USE
< prev
next >
Wrap
Text File
|
1980-01-01
|
7KB
|
243 lines
{ The Smallest MacApp Application }
{ Copyright 1986 by Productivity Products International, Inc.}
{ The MAIN Program }
PROGRAM SmallApp;
USES
{ This set of units are portions of the Macintosh ROM }
MemTypes, QuickDraw, OSIntf, ToolIntf,
{ This set of units are portions of MacApp }
UObject, UList, UMacApp, UPrinting,
{ This unit has the SmallApp-specific classes }
USmallApp;
VAR aSmallApplication: TSmallApplication; { The application object -
only one of these per application }
BEGIN
InitToolbox(8); { initialize the ToolBox; 8 calls to MoreMasters }
InitPrinting; { initialize the print shop }
New(aSmallApplication);
aSmallApplication.ISmallApplication;
aSmallApplication.Run;
END.
{ *** The Unit it uses. This is typically in two separate files: one for the
interface and one for the implementation. ***}
{ The Smallest Possible MacApp Application }
{ Copyright 1986 by Productivity Products International,
Inc. }
UNIT USmallApp;
INTERFACE
USES
{ This set of units are portions of the Macintosh ROM }
MemTypes, QuickDraw, OSIntf, ToolIntf, PackIntf,
{ This set of units are portions of MacApp }
UObject, UList, UMacApp, UPrinting;
CONST
myFileType = 'MAMO'; { The file type ("MacApp MOuse') for documents
of this application }
mySignature = 'SMAP'; { The application signature of SMall
APplication }
myWindowType = 1001; { The resource ID of the WIND resource which
defines the windows used to
display the documents of this application.
}
TYPE
TSmallApplication = OBJECT(TApplication)
{ ----- INITIALIZE THE APPLICATION ----- }
PROCEDURE TSmallApplication.ISmallApplication;
{ ----- MAKE A DOCUMENT ----- }
FUNCTION TSmallApplication.DoMakeDocument(itsCmdNumber: CmdNumber):
TDocument; OVERRIDE;
END;
TSmallDocument = OBJECT(TDocument)
{ ----- FIELDS ----- }
fSmallView: TSmallView;
{ ----- INITIALIZE A DOCUMENT ----- }
PROCEDURE TSmallDocument.ISmallDocument;
{ ----- MAKE A VIEW ----- }
PROCEDURE TSmallDocument.DoMakeViews(forPrinting: BOOLEAN); OVERRIDE;
{ ----- MAKE A WINDOW ----- }
PROCEDURE TSmallDocument.DoMakeWindows; OVERRIDE;
END;
TSmallView = OBJECT(TView)
{ ----- INITIALIZE A VIEW ----- }
PROCEDURE TSmallView.ISmallView(itsSmallDocument: TSmallDocument);
{ ----- RENDER THE IMAGE ----- }
PROCEDURE TSmallView.Draw(area: Rect); OVERRIDE;
END;
IMPLEMENTATION
{ Copyright 1985 by Productivity Products International, Inc.}
{ USmallApp Implementation }
{
*****************************************************************************}
{
*****************************************************************************}
{ METHODS FOR ALL THE SMALLAPP CLASSES
}
{
}
{ Note that methods are grouped by class and that the order of methods in
any class is the following }
{ (by convention only, since Object Pascal forces no order): }
{
}
{ (1) the initialization method, if any, }
{ (2) the Inspect method - a private debugging method, if needed }
{ (3) the Free method, if overridden, and}
{ (4) the remaining methods in alphabetical order. }
{
}
{ ************************************************************************* }
{ ************************************************************************* }
{ ************** TSmallApplication Methods ********************* }
PROCEDURE TSmallApplication.ISmallApplication;
BEGIN
SELF.IApplication(myFileType);
END;
{ ----- MAKE AND INITIALIZE A DOCUMENT ----- }
FUNCTION TSmallApplication.DoMakeDocument(itsCmdNumber: CmdNumber):
TDocument; OVERRIDE;
VAR aSmallDocument:TSmallDocument;
BEGIN
NEW(aSmallDocument);
aSmallDocument.ISmallDocument;
DoMakeDocument := aSmallDocument;
END;
{ *************** TSmallDocument Methods ********************** }
PROCEDURE TSmallDocument.ISmallDocument;
BEGIN
SELF.IDocument(myFileType, mySignature, TRUE, FALSE);
END;
{ ----- MAKE AND INITIALIZE ALL THE NECESSARY VIEWS ----- }
PROCEDURE TSmallDocument.DoMakeViews(forPrinting: BOOLEAN); OVERRIDE;
VAR smallView: TSmallView;
BEGIN
NEW(smallView);
smallView.ISmallView(SELF);
SELF.fSmallView := smallView;
END;
{ ----- MAKE ALL THE NECESSARY WINDOWS ----- }
PROCEDURE TSmallDocument.DoMakeWindows; OVERRIDE;
VAR aWindow: TWindow;
BEGIN
aWindow := NewSimpleWindow(myWindowType, FALSE { NOT a DialogWindow},
kWantHScrollBar, kWantVScrollBar,
SELF.fSmallView);
END;
{ ************************** TSmallView Methods ************************ }
PROCEDURE TSmallView.ISmallView(itsSmallDocument: TSmallDocument);
VAR viewRect: Rect;
aStdHandler: TStdPrintHandler;
BEGIN
SetRect(viewRect, 0, 0, 500, 500);
IView(NIL, { This view has no parent view, }
itsSmallDocument, { and shows a smallDocument, }
viewRect, { in a 500 x 500 rectangle, }
sizeFixed, { that does not change if the }
{ frame is changed horizontally,}
sizeFixed, { or vertically, }
FALSE, { and can't make selections }
hlOff); { and doesn't highlight when the}
{ window is inactive. }
New(aStdHandler);
aStdHandler.IStdPrintHandler(SELF, FALSE); { The second parameter,
itsSquareDots, is FALSE since this application does not mix text
and graphics. Slightly higher resolution is available with this
setting. }
END;
{ ----- RENDER THE IMAGE ----- }
PROCEDURE TSmallView.Draw(area: Rect); OVERRIDE;
FUNCTION MakeRect(top, left, bottom, right: INTEGER): Rect;
VAR r: Rect;
BEGIN
SetRect(r, left, top, right, bottom);
MakeRect := r;
END;
BEGIN
PenNormal;
PaintOval(MakeRect(74, 72, 139, 127)); { Outline of the mouse head }
EraseOval(MakeRect(84, 74, 138, 125)); { Outline of the mouse face }
FrameOval(MakeRect(109, 84, 129, 115)); { Mouse mouth (part 1 of 2) }
EraseRect(MakeRect(109, 84, 123, 115)); { Mouse mouth (part 2 of 2) }
FrameOval(MakeRect(98, 87, 107, 96)); { Left eye }
FrameOval(MakeRect(98, 104, 107, 113)); { Right eye }
PaintOval(MakeRect(101, 90, 104, 93)); { Left pupil }
PaintOval(MakeRect(101, 107, 104, 110)); { Right pupil }
PaintOval(MakeRect(111, 97, 117, 103)); { Nose }
PaintOval(MakeRect(53, 52, 91, 90)); { Left ear }
PaintOval(MakeRect(53, 110, 91, 148)); { Right ear }
FrameRect(MakeRect(20, 20, 170, 180)); { A bounding rectangle }
END;
END.